package com.jic.member.service.eventHandler.impl;

import com.alibaba.fastjson.JSONArray;
import com.jic.common.base.tuple.Tuple;
import com.jic.member.entity.model.EventListenerContent;
import com.jic.member.entity.model.TripBranchNode;
import com.jic.member.service.eventHandler.EventHander;

import java.util.function.BiFunction;

/**
 * description: MemberEnventHandlerTemplate
 * date: 2020/6/8 11:28
 * author: wangys
 * version: 1.0
 */
public abstract class EventHandlerTemplate implements EventHander {
    @Override
    public Tuple<Boolean, String> validateParam(EventListenerContent content, Long branchNodeId) {
        Tuple<Boolean, String> tuple = new Tuple<>();
        tuple.setF(true);
        tuple.setS(null);
        return tuple;
    }


    public BiFunction<EventListenerContent, Long, JSONArray> parseNodeVariable = (c, b)->{
        TripBranchNode tripBranchNode = c.getTripBranchNodeMap().get(b);
        JSONArray jsonArray = JSONArray.parseArray(tripBranchNode.getNodeVariable());
        return jsonArray;
    };
}
